package com.hdq.mapper;

import com.github.pagehelper.Page;
import com.hdq.annotation.AutoFill;
import com.hdq.annotation.ManagerName;
import com.hdq.enumeration.OperationType;
import entity.Manager;
import entity.User;
import org.apache.ibatis.annotations.*;
import vo.ManagerPageVO;
import vo.ManagerXiaLalistVO;
import vo.NoticePageVO;

import java.util.List;

@Mapper
public interface ManagerMapper {

    /**
     * 根据用户名查询管理员信息
     * @param username
     * @return
     */
    @Select("select * from manager where username = #{username}")
    Manager getManagerByUsername(String username);

    /**
     * 根据id获取管理员信息
     * @param id
     * @return
     */
    @Select("select * from manager where id = #{id}")
    Manager getManagerById(Long id);

    Page<ManagerPageVO> selectByPage(Manager manager);

    @Insert("insert into manager (status, create_time, update_time, create_manager_id,last_update_manager_id,username, password, avatar, role_id, is_super) values (#{status},#{createTime},#{updateTime},#{createManagerId},#{lastUpdateManagerId},#{username},#{password},#{avatar},#{roleId},#{isSuper})")
    @AutoFill(OperationType.INSERT)
    @ManagerName(OperationType.INSERT)
    void insert(Manager manager);

    @AutoFill(OperationType.UPDATE)
    @ManagerName(OperationType.UPDATE)
    void update(Manager manager);

    void delete(List<Long> ids);

    void banned(@Param("ids") List<Long> ids ,@Param("status") Integer status);

    @Select("select * from manager")
    List<ManagerXiaLalistVO> selectXiaLa();
}
